meta_content = "upJUt_MyRs9f4iAfbBbJVBACSL8hjTY.JJyKOVFRHAdTChUScDJwUCsneksW3c1q8G6P.UUw6pwIu6pMkdUU6Za5Tnx0XPo7OXqCgLPxz3lJx7ycJWJlUA08Tb.r6NChRcJclJUeBml"
window = self = top = global
window.addEventListener = function () {

}
div = {
    getElementsByTagName() {
        return []
    },

}
_head = {
    removeChild: function () {

    }
}
script = {
    getAttribute(attr) {
        console.log("script attr", attr)
        if (attr === "r") {
            return "m"
        }
    },
    parentElement: _head
}
meta = {
    content: meta_content,
    getAttribute(attr) {
        console.log("meta attr", attr)
        if (attr === "r") {
            return "m"
        }
        // if (attr === "content") {
        //     return
        // }
    },
    parentNode: _head,

}
document = {
    getElementById(){},
    appendChild() {
    },
    removeChild() {
    },
    createElement(ele) {
        console.log("document createElement", ele)
        if (ele === "div") {
            return div
        } else {
            return {}
        }
    },
    getElementsByTagName(ele) {
        console.log("document getElementsByTagName", ele)
        if (ele === "script") {
            return [script, script]
        }
        if (ele === "meta") {
            return [meta, meta]
        }
        if (ele === "base") {
            return []
        } else {
            return []
        }
    }

}


location = {
    "ancestorOrigins": {},
    "href": "https://www.ouyeel.com/search-ng/queryResource/index",
    "origin": "https://www.ouyeel.com",
    "protocol": "https:",
    "host": "www.ouyeel.com",
    "hostname": "www.ouyeel.com",
    "port": "",
    "pathname": "/search-ng/queryResource/index",
    "search": "",
    "hash": ""
}
navigator = {
    userAgent:'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36'
}
// 代理监控
function setProxyArr(proxyObjArr) {
    for (let i = 0; i < proxyObjArr.length; i++) {
        const objName = proxyObjArr[i];
        const handler = {
            get(target, property, receiver) {
                console.log("方法:", "get", "对象:", objName, "属性:", property, "属性类型：", typeof property, "属性值：", target[property], "属性值类型：", typeof target[property]);

                return target[property];
            },
            set(target, property, value, receiver) {
                console.log("方法:", "set", "对象:", objName, "属性:", property, "属性类型：", typeof property, "属性值：", value, "属性值类型：", typeof target[property]);
                return Reflect.set(target, property, value, receiver);
            }
        };
        // 检查并初始化对象
        let targetObject = global[objName] || {};  // 在 Node.js 环境中使用 global
        global[objName] = new Proxy(targetObject, handler);  // 在 Node.js 中使用 global
    }
}

setProxyArr(["window", "document", "div", "script", "meta","navigator"])

